import java.awt.Color;

	/**************************************** 
	*  Submitted by:                        *   
	*                                       *
	*  Michael Fildstein, ID: 309161594     *  
	*  Tomer Ben Rachel, ID: 021982475      *
	*   		                          			*
	*****************************************/ 
   
//This program draws a super snowflake which is a specific pattern of snowflakes, who vary by color, on the screen.
//It does this using the previous assignment's function, drawSnowflake, and with the function listed below, drawCircle.

public class SuperSnowflake {
	
	
	public static void main(String args[]) {
        Painter.draw("SuperSnowflake");
    }
	
	public static void draw() { 
		int height = Painter.getFrameHeight()/2;
		int width = Painter.getFrameWidth()/2;
		int maxRadius = Math.min(height, width)/2;
		int size = maxRadius/4; 	  
		Painter.setColor(Color.blue);
		drawCircle(width, height, size*3, size, 3);
		}
	
   
  //The function drawCircle prints onto the screen a series of snowflakes, in a certain circle defined by the center point           //and radius
	public static void drawCircle( int x, int y, int radius, int size, int depth ){
	  
    if (depth % 2 != 0){                //Making sure that there are 
      Painter.setColor(Color.red);      //alternating colors for each circle 
			
		}else{
			Painter.setColor(Color.blue);
		}
		if (depth != 0){
			for (int i = 0; i<6; i++) {
				int endX = x + (int)(radius*Math.cos(2*Math.PI/6*i));
				int endY = y - (int)(radius*Math.sin(2*Math.PI/6*i )); 
				Snowflake.drawSnowflake(endX, endY, size / 2, depth + 1);   //Draws a snowflake
			}
			drawCircle(x, y, radius + (3*size), size / 2, depth - 1);     //Draws another circle with a bigger radius, but of a                                                                              //smaller size
		}
		if (depth == 3){                                                //Center snowflake
			Snowflake.drawSnowflake(x, y, size, depth);
		}
		
	}
}	
